#ifndef	_GLOBAL_H_
#define	_GLOBAL_H_

#include <sc.h>
// #include "Config.h"

#ifdef _SC8F072
#define _USE_SC8F072_    (1)
#endif
#ifdef _SC8F2892B
#define _USE_SC8F2892B_  (1)
#endif

#define _END_CODE_ADDRESS_  2047

#define  unchar     unsigned char 
#define  unint        unsigned int
#define  unlong     unsigned long
typedef	unsigned char	uint8;
#define uchar unsigned char
#define INT8U   uint8
#define uint8_t         uint8
typedef	volatile unsigned char vuint8;
typedef	char			int8;
typedef	volatile char	vint8;
typedef	unsigned int	uint16;
#define uint16_t        uint16
typedef	volatile unsigned int	vuint16;
typedef	int				int16;
typedef volatile int	vint16;
typedef unsigned long   uint32;

#define		YES		1
#define		NO		0

#define		HIGH	1
#define		LOW		0

#define		NULL	0
#define     INFINITE  0xFF


#ifdef	_GLOBAL_VAR_
#define	EXTERN
#else
#define	EXTERN	extern
#endif

#ifndef _XTAL_FREQ
 #define _XTAL_FREQ 16000000			//8Mhz,ʹ��������ʱ�������붨����Ƶ
#endif

#define GCC_DELAY   _delay
#define GCC_CLRWDT()    asm("clrwdt")


#define _DEBUG_EN_  (1)


EXTERN uint8 KeyCount;
EXTERN uint16 ID;

#if _USE_SC8F072_
const uint8 TAB_ID[2]@0x07FC;       //---- 2K
#elif _USE_SC8F2892B_
// const uint8 TAB_ID[2]@0x0FF8;     //---- 4K
const uint8 TAB_ID[2]@0x07FC;       //---- 2K
#endif

// EXTERN const uint16 TAB_ID@0x07FC;


// EXTERN bit f_WakeUp;
EXTERN uint8 CntDelaySleep;
EXTERN uint8 TmDelayPowerOn;
//EXTERN uint8 TypeSel;
EXTERN uint16 TmDelayAutoExit;
EXTERN uint8 CntEnterTestMode;
EXTERN uint8 KeyPressTimes;

EXTERN uint8 PowerOnState;

// EXTERN volatile bit    f_Event_TimeBase10ms;
// EXTERN vuint8  CntTimeBase10ms;
// EXTERN uint8  CntTimeBase500ms;
// EXTERN uint8  CntTimeBase1S;
EXTERN vuint8  CntTimeBase8ms;
EXTERN volatile bit f_Event_TimeBase8ms;
// volatile bit f_Event_TimeBase100us;
#endif
